<template>
  <span @click="handleClick">关闭实时路况</span>
</template>

<script setup>
import { toRefs } from 'vue'
import { useMapStore } from '@/stores/map' // 使用pinia
const { map } = toRefs(useMapStore())

function handleClick() {
  let layerArr = map.value.getLayers().getArray()
  layerArr.forEach((item) => {
    if (item.values_.title == 'trafficArr') {
      item.setVisible(false)
    }
  })
}
</script>
